<template>
	<view class="content">
		<video class="video" src="http://81.68.191.86/manufacturing_process.mp4" autoplay="true" loop="true"></video>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<image src="/static/baobao.jpg" mode="widthFix" class="baobao"/>
		<view class="all-gift">
			<image class="icon iphone" :animation="animationData1" src="/static/gift.png" @click="getIPhone()"/>
			<image class="icon small-video" :animation="animationData2" src="/static/video_icon.png" @click="getSmallVideo()"/>
		</view>
		<view class="text-area">
			<text class="bottom-text">{{bottomText}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bottomText: '祝我的小殷生日快乐鸭\n小仙鹤年年18岁\n感谢一路有你❤️',
				title:"带珍珠耳环的少女制作过程",
				animationData1: [],
				animationData2: [],
				animationTime:0,
			}
		},
		onLoad() {
			var animation = uni.createAnimation({
				duration: 1000,
				timingFunction: 'ease',
			})
			setInterval(function() {
				if(this.animationTime == 0){
					animation.scale(1.1,1.1).step()
					this.animationData1 = animation.export()
					animation.scale(0.9,0.9).step()
					this.animationData2 = animation.export()
					this.animationTime++
				}else{
					animation.scale(0.9,0.9).step()
					this.animationData1 = animation.export()
					animation.scale(1.1,1.1).step()
					this.animationData2 = animation.export()
					this.animationTime--
				}
			}.bind(this), 1500)
		},
		methods: {
			getSmallVideo(){
				uni.showModal({
				    title: '获得隐藏礼物②🎁',
				    content: '小视频观看教程 × 1',
					cancelText:'返回',
					confirmText:'收下',
				    success: function (res) {
				        if (res.confirm) {
							uni.navigateTo({
								url:'../small-video/small-video'
							})
				        }
				    }
				});
			},
			getIPhone() {
				uni.showModal({
				    title: '获得隐藏礼物①🎁',
				    content: 'iPhone13pro 256g 远峰蓝 × 1',
					cancelText:'返回',
					confirmText:'收下',
				    success: function (res) {
				        if (res.confirm) {
							uni.showLoading({
								title: '加载中'
							});
							setTimeout(function() {
								uni.hideLoading();
							}, 2000);
							window.open("https://www.apple.com.cn/xc/cn/vieworder/W870691023/914138410@qq.com")
				        }
				    }
				});
				
			}
		}
	}
</script>

<style>
	.title{
		font-size: 36rpx;
		text-align: center;
		margin-top: 50rpx;
		outline-style: dashed;
		outline-color: #007AFF;
		padding: 10rpx;
		outline-width: 8rpx ;
	}
	.baobao{
		width: 600rpx;
		margin-top: 50rpx;
	}
	
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 50rpx;
	}

	.icon {
		height: 100rpx;
		width: 100rpx;
	}
	.all-gift{
		margin-top: 50rpx;
	}
	.video{
		width: 600rpx;
	}
	.small-video{
		margin-left: 50rpx;
	}
	.text-area {
		display: flex;
		justify-content: center;
	}

	.bottom-text {
		margin-top: 50rpx;
		font-size: 36rpx;
		text-align: center;
		outline-style: dashed;
		outline-color: #feb462;
		padding: 10rpx;
		outline-width: 8rpx ;
	}
</style>
